//package com.example.demo.controller;
//
//import com.example.demo.entity.MyMessage;
//import com.fasterxml.jackson.core.JsonProcessingException;
//import com.fasterxml.jackson.core.type.TypeReference;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//
//@RocketMQMessageListener(topic = "my-test", consumerGroup = "demo-test-group")
//@Component
//public class DemoConsumer implements RocketMQListener<MyMessage> {
//    @Autowired
//    private ObjectMapper objectMapper;
//    @Override
//    public void onMessage(MyMessage s) {
//        System.out.println("接收消息：" + s);
////        try {
////            List<MyMessage> messages = objectMapper.readValue(s, new TypeReference<List<MyMessage>>() {
////
////            });
////            messages.forEach(System.out::println);
////        } catch (JsonProcessingException e) {
////            e.printStackTrace();
////        }
//
//    }
//}
